package mylibrary.serialize.example.extend;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Test {

	public static void main(String[] args) throws Exception {
		
		SubClass sub = new SubClass("111", "222");
		
		FileOutputStream fos = new FileOutputStream("c:\\tempData.ser");
		ObjectOutputStream oos = new ObjectOutputStream(fos);
		oos.writeObject(sub);
		oos.flush();
		
		FileInputStream fis = new FileInputStream("c:\\tempData.ser");
		ObjectInputStream ois = new ObjectInputStream(fis);
		SubClass sub_r = (SubClass) ois.readObject();
		System.out.println(sub_r.getFirstName());
		ois.close();
	}
}
